home *** CD-ROM | disk | FTP | other *** search
/ PC User 2002 July / Disc 2 / PCU0702CD2.iso / entertn / floaters / files / Control / FMInstaller / data1.cab / FunMachine_Files / FMinterface.dxr / 00023.ls < prev    next >
Encoding:
Text File  |  2002-05-17  |  1.0 KB  |  44 lines

  1. property _LegalChars, _MaxNoOfChars
  2.  
  3. on getPropertyDescriptionList
  4.   _list = [:]
  5.   addProp(_list, #_LegalChars, [#comment: "keys allowed", #format: #string, #default: " "])
  6.   addProp(_list, #_MaxNoOfChars, [#comment: "maximum number of chars", #format: #integer, #default: 8])
  7.   return _list
  8. end
  9.  
  10. on beginSprite me
  11.   the keyboardFocusSprite = me.spriteNum
  12. end
  13.  
  14. on keyDown me
  15.   if the key = RETURN then
  16.     if sprite(me.spriteNum).member.text.length = _MaxNoOfChars then
  17.     end if
  18.   else
  19.     if the key = BACKSPACE then
  20.       pass()
  21.     else
  22.       if the key = SPACE then
  23.         pass()
  24.       else
  25.         if the keyCode = 123 then
  26.           pass()
  27.         else
  28.           if the keyCode = 124 then
  29.             pass()
  30.           else
  31.             if _LegalChars contains the key then
  32.               if sprite(me.spriteNum).member.text.length < _MaxNoOfChars then
  33.                 pass()
  34.               end if
  35.             else
  36.               dontPassEvent()
  37.             end if
  38.           end if
  39.         end if
  40.       end if
  41.     end if
  42.   end if
  43. end
  44.